import newsInter from "../../api/news";

const actions = {
    // 行业资讯——菜单
    getHyzxMenu({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getHyzxMenu(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 行业资讯——列表
    getHyzxList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getHyzxList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 行业资讯——详情
    getHyzxDes({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getHyzxDes(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 企业资讯——菜单
    getQyzzMenu({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getQyzzMenu(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 企业资讯——列表
    getQyzzList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getQyzzList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 企业资讯——详情
    getQyzzDes({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getQyzzDes(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },

    // 赛事管理——菜单
    getSsglMenu({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getSsglMenu(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 赛事管理——列表
    getSsglList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getSsglList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 赛事管理——详情
    getSsglDes({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getSsglDes(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },

    // 专业培训——菜单
    getZypxMenu({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZypxMenu(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 专业培训——列表
    getZypxList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZypxList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 专业培训——详情
    getZypxDes({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZypxDes(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },

    // 会员之窗——菜单
    getHyzcMenu({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getHyzcMenu(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 会员之窗——列表
    getHyzcList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getHyzcList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    // 会员之窗——详情
    getHyzcDes({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getHyzcDes(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },

    // 行业资讯 搜索
    getInfoList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getInfoList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },

    //地方协会
    getGygxList({ commit }) {
        return new Promise((resolve, reject) => {
            newsInter
                .getGygxList()
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },

    //关于我们
    getAoutUsList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getAoutUsList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },

    //会员之窗
    getMemberList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getMemberList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    //会员之窗--详情
    getMemberDes({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getMemberDes(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    //培训资讯
    getTrainList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getTrainList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    //培训资讯--详情
    getTrainDes({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getTrainDes(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    //证书查询
    getTrainQuery({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getTrainQuery(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    //作品展示
    getZuoping({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZuoping(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    getZuopingImg({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZuopingImg(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    getZuopingNavList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZuopingNavList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    getZuopingChildList({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZuopingChildList(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
    getZuopingChildListVideo({ commit }, data) {
        return new Promise((resolve, reject) => {
            newsInter
                .getZuopingChildListVideo(data)
                .then((response) => {
                    const { data } = response;
                    if (!data) {
                        reject("Verification failed, please Login again.");
                    }
                    resolve(data);
                })
                .catch((error) => {
                    reject(error);
                });
        });
    },
};

export default {
    namespaced: true,
    actions,
};
